package com.cn.aam.checaiduo.backend.api;

import com.cn.aam.checaiduo.bean.UserB;
import com.cn.aam.checaiduo.bean.base.BaseResponseB;
import com.cn.aam.checaiduo.bean.base.NormalResponseB;

import io.reactivex.Observable;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Path;

/**
 * Created by 艹羊 on 2017/5/22.
 */

public interface UserApi {

    /**
     * 登录操作
     *
     * @param mobile
     * @param password
     * @return Call<NormalResponseB>
     */
    @FormUrlEncoded
    @POST("Wap/InternalApi/login")
    Observable<NormalResponseB<UserB>> login(@Field("mobile") String mobile, @Field("password") String password);

    /**
     * 获取验证码
     *
     * @param mobile
     * @return
     */
    @GET("Wap/InternalApi/refreshSmscode/mobile/{mobile}")
    Observable<BaseResponseB> getMsgCode(@Path("mobile") String mobile);

    /**
     * 注册步骤1
     *
     * @param mobile
     * @param smscode
     * @return
     */
    @FormUrlEncoded
    @POST("Wap/InternalApi/registerStep1")
    Observable<BaseResponseB> registerStep1(@Field("mobile") String mobile, @Field("smscode") String smscode);

    /**
     * 注册步骤2
     *
     * @param mobile
     * @param password
     * @return
     */
    @FormUrlEncoded
    @POST("Wap/InternalApi/registerStep2")
    Observable<BaseResponseB> registerStep2(
            @Field("mobile") String mobile,
            @Field("password") String password,
            @Field("invite_code") String invite_code,
            @Field("source") String source);


    /**
     * 忘记密码步骤1
     *
     * @param mobile
     * @return
     */
    @FormUrlEncoded
    @POST("Wap/InternalApi/forgetPasswordStep1")
    Observable<BaseResponseB> forgetPwdStep1(@Field("mobile") String mobile);

    /**
     * 忘记密码步骤2
     *
     * @param mobile
     * @param password
     * @return
     */
    @FormUrlEncoded
    @POST("Wap/InternalApi/forgetPasswordStep2")
    Observable<BaseResponseB> forgetPwdStep2(@Field("mobile") String mobile, @Field("smscode") String smscode, @Field("password") String password);


    /**
     * 退出登录
     *
     * @return
     */
    @GET("Wap/InternalApi/logout")
    Observable<BaseResponseB> logout();


}
